from LeetCoder import *


class Solution:

    def buyChoco(self, prices: List[int], money: int) -> int:
        if len(prices) < 2:
            return money
        prices.sort()
        return money if prices[0] + prices[1] > money else money - (prices[0] +
                                                                    prices[1])


s = Solution()
print(s)
